package com.ddwl.schema.bo.shop;

import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author hemiaojun
 * @Date 2021/5/6 15:36
 */
@ApiModel("快递配送设置Bo")
@Getter
@Setter
public class LogisticsBo {

    @ApiModelProperty(value="id")
    private String id;

    @NotEmpty(message = "店铺id不能为空")
    @ApiModelProperty(value="店铺id",required = true)
    private String shopId;

    @NotEmpty(message = "快递发货地址不能为空")
    @ApiModelProperty(value="快递发货地址",required = true)
    private String expressAddr;

    @ApiModelProperty(value = "快递发货地址经度")
    private String expressLng;

    @ApiModelProperty(value = "快递发货地址纬度")
    private String expressLat;

    @NotNull(message = "快递发货时间不能为空")
    @ApiModelProperty(value = "快递发货时间", required = true)
    private Integer expressSendTime;

    @NotNull(message = "是否包邮不能为空")
    @ApiModelProperty(value="是否包邮：0否，1是",required = true)
    private Integer freeTag;

    @ApiModelProperty(value="包邮区域：0不包邮 1全国包邮，2省份包邮",notes = "如果是否包邮选择 1是，则选择1或2，如果是否包邮选择 0否，则填0",required = true)
    private Integer freeArea;

    @ApiModelProperty(value="包邮省份",notes = "如果包邮区域选择 2省份包邮，则该项必填")
    private String freeList;

    @ApiModelProperty(value = "波动邮费方式：0没有，1按件数")
    private Integer waveType;

    @ApiModelProperty(value = "基础邮费")
    private BigDecimal basePostage;

    @ApiModelProperty(value = "每增加多少件",notes = "波动邮费方式选择 按件数 则必填")
    private Integer addNumber;

    @ApiModelProperty(value = "增加多少元",notes = "波动邮费方式选择 按件数 则必填")
    private BigDecimal addNumPrice;

    @ApiModelProperty(value="特殊省份")
    private String specialList;

    @ApiModelProperty(value = "特殊身份波动邮费方式：0没有，1按件数")
    private Integer specialWaveType;

    @ApiModelProperty(value = "特殊省份基础邮费")
    private BigDecimal specialBasePostage;

    @ApiModelProperty(value = "每增加多少件（特殊省份）",notes = "特殊身份波动邮费方式选择 按件数 则必填")
    private Integer specialAddNumber;

    @ApiModelProperty(value = "增加多少元（特殊省份）",notes = "特殊身份波动邮费方式选择 按件数 则必填")
    private BigDecimal specialAddPrice;


    public Map<String,Object> toMap(){
        Map<String, Object> map = new HashMap<>(16);
        if (StrUtil.isNotEmpty(this.getFreeList())) {
            map.put("freeList", this.getFreeList());
        }
        if (null != this.getWaveType()) {
            map.put("waveType", this.getWaveType());
        }
        if (null != this.getBasePostage()) {
            map.put("basePostage", this.getBasePostage());
        }
        if (null != this.getAddNumber()) {
            map.put("addNumber", this.getAddNumber());
        }
        if (null != this.getAddNumPrice()) {
            map.put("addNumPrice", this.getAddNumPrice());
        }
        if (StrUtil.isNotEmpty(this.getSpecialList())) {
            map.put("specialList", this.getSpecialList());
        }
        if (null != this.getSpecialWaveType()) {
            map.put("specialWaveType", this.getSpecialWaveType());
        }
        if (null != this.getSpecialBasePostage()) {
            map.put("specialBasePostage", this.getSpecialBasePostage());
        }
        if (null != this.getSpecialAddNumber()) {
            map.put("specialAddNumber", this.getSpecialAddNumber());
        }
        if (null != this.getSpecialAddPrice()) {
            map.put("specialAddPrice", this.getSpecialAddPrice());
        }
        return map;
    }

}
